<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	
	
	protected function _initAutoload() {
		$modelLoader = new Zend_Application_Module_Autoloader(array(
			'namespace' => '',
			'basePath' => APPLICATION_PATH.'/modules/default'));
		
		/*if(Zend_Auth::getInstance()->hasIdentity()) {
		 
		 Zend_Registry::set('role', 'guests');
		 
		 } else {
		 Zend_Registry::set('role', 'guest');
		 }
		 
		 $this->_acl = new Model_LibraryAcl;
		 $this->_auth = Zend_Auth::getInstance();
		 
		 $fc = Zend_Controller_Front::getInstance();
		 $fc->registerPlugin(new Plugin_AccessCheck($this->_acl));*/
		
		return $modelLoader;
	}
	
	
	/**
	 * Gestion des sessions
	 */
	
	protected function _initSession() {
		//Le logger
		$logger = new Zend_Log();
		//Le writer
		$writer =new Zend_Log_Writer_Firebug();
		$logger->addWriter($writer);
		Zend_Registry::set ( 'logger', $logger );
		// On initialise la session
		$session = new Zend_Session_Namespace ( 'zftutoriel', true );
		Zend_Registry::set ( 'session', $session );
		Zend_Registry::set ( 'Zend_Locale', 'en' );	
		//Zend_Session::start();
		
		//return $session;
	}
	
	
	
	
	
	protected function _initViewHelpers() {
		$this->bootstrap('layout');
		$layout = $this->getResource('layout');
		$view = $layout->getView();
		
		$view->setHelperPath(APPLICATION_PATH.'/helpers', '');
		$view->doctype('HTML4_STRICT');
		$view->headMeta()->appendHttpEquiv('Content-type', 'text/html;charset=iso-8859-15');
		$view->headMeta()->appendHttpEquiv('Description', 'Plateforme de gestion automatis&eacute;e de votre domicile ou de vos bureaux');
		//$view->headMeta()->appendHttpEquiv('Keywords', 'Domotique, video surveillance, maison, camera ip, anti intrusion, video on demand, ');		
		
		//Zend_Auth::getInstance()->clearIdentity();			
		
		$view->headTitle()->setSeparator(' - ')
		->headTitle('Abscool');
		
		//Chargement CSS
		
		$view->headLink()->prependStylesheet(APPLICATION_URL.'/css/abEmploiDuTemps.css', 'screen');
		$view->headLink()->prependStylesheet(APPLICATION_URL.'/css/abGrid.css', 'screen');
		$view->headLink()->prependStylesheet(APPLICATION_URL.'/css/jquery-ui-1.8.14.custom.css', 'screen');
		$view->headLink()->prependStylesheet(APPLICATION_URL.'/css/index.css', 'screen');
		$view->headLink()->prependStylesheet(APPLICATION_URL.'/css/jquery.wysiwyg.css', 'screen');
		//Chargement JS
		$view->headScript()->prependFile(APPLICATION_URL.'/js/findPos.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/wysiwyg.link.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/wysiwyg.table.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/jquery.wysiwyg.js');		
		$view->headScript()->prependFile(APPLICATION_URL.'/js/interface.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/myGrid.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/abEmploiDuTemps.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/jquery-ui-1.8.14.custom.min.js');
		$view->headScript()->prependFile(APPLICATION_URL.'/js/jquery.tools.min.js');
		//Zend_Auth::getInstance()->clearIdentity();
		
		// base helpers
		$view->addHelperPath(APPLICATION_PATH . '/modules/default/views/helpers');        
		$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
		$viewRenderer->setView($view);		
		
	}
	
	protected function _initPlugins()
		{
		// Access plugin
		$front = Zend_Controller_Front::getInstance(); 
		$front->registerPlugin(new Myapp_Module());
		}
	
}

